package homework0822;

import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {

        //定义容器
        HashSet red = new HashSet();
        HashSet blue = new HashSet();
        HashSet blue1 = new HashSet();
        //开始装入
        int count = 0;
        while (true) {
            blue.add((int) Math.floor(Math.random() * 33));
            if (blue.size() > 6) break;
        }
        red.add((int) Math.floor(Math.random() * 33));
        //看一眼都输出了什么，方便测试
        for (Object j : blue
        )
            System.out.println("蓝色" + j);
        System.out.println("红色" + red);
        //用户输入
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入红色");
        Integer a = sc.nextInt();
        for (int i = 1; i <= 7; i++) {
            System.out.println("请输入第" + i + "个蓝色");
            blue1.add(sc.nextInt());
        }
        //开始验证
        if (red.contains(a) == true) {
            System.out.println("红色球对上了");
            count++;
        }
        for (Object k : blue1
        ) {
            if (blue.contains(k))
                count++;
        }
        //展示结果
        if (count == 0) System.out.println("很遗憾，您一个都没中");
        else System.out.println("恭喜您，您中了" + count + "个球");
    }
}
